package bservice

import (
    "golang.org/x/crypto/bcrypt"
)

func (Service) PasswordHash(text string) (string, error) {
    bytes, err := bcrypt.GenerateFromPassword([]byte(text), 14)
    return string(bytes), err
}

func (Service) PasswordVerify(text, hash string) bool {
    err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(text))
    return err == nil
}
